<?php
class Comment extends Publication{
	var $content;
	var $comment;
	var $referedTo;
	
	function Comment($pId){
		global $wpdb;
		
		// Instanciation de parent
		parent::Publication("COMMENT", $pId);

		// Instanciation de this
		$_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM comments WHERE id = %d", $pId));		
		$this->content = $_row->content;
		
	}
	
	/**
	 * Enter description here ...
	 */
	function create(){}
	/**
	 * Enter description here ...
	 */
	function save(){}
	
	function delete()
	{
		
	}
	
	
	/**
	 * Enter description here ...
	 */
	function toHTML(){
		$_owner = $this->getOwner();
		?>
		<div class="div_comment">
			<div class="div_userPicture">
				<img src="http://localhost/weebeet.com/wp-content/themes/toolbox/style/generic/images/users/default.png">
			</div>
			<div class="div_content">
				<a href="?profile=<?php echo $_owner->getID(); ?>" class="userNickname"><?php $_owner->getNickname(); ?></a> - 
				<span class="c_9"><?php $this->getDate(). " à " . $this->getHour(); ?></span> - 
				<?php $this->getContent(); ?>
			</div>
			<div class="div_action">
				<span class="fl action tiptip icon_20 deletePublication cursor" action="deleteComment" commentID='<?php echo $this->getId(); ?>'></span>
				<span class="fl action tiptip icon_20 signalPublication cursor" action="signalComment" commentID='<?php echo $this->getId(); ?>'></span>
			</div>
		</div>
		<?php
	}

	
	public function setComment($comment)
	{
	    $this->comment = $comment;
	}
	
	public function getComment()
	{
	    return $this->comment;
	}
	
	public function setReference($referTo)
	{
	    $this->referTo = $referTo;
	}
	
	public function getReference()
	{
	    return $this->referTo;
	}
}